package com.yy.job.core.domain.context;

import java.util.Date;

import com.yy.job.common.enums.JobActionEnum;
import com.yy.job.common.enums.JobStatusEnum;
import com.yy.job.core.config.xml.JobXmlConfig;
import com.yy.job.core.domain.JobDomain;

/**
 * job容器，上下文
 * 
 * @author eleven.li
 *
 */
public class JobContext extends ProcessContext{
	
	private JobDomain jobDomain;
	
	/**
	 * xml配置信息
	 */
	private JobXmlConfig jobXmlConfig;
	
	
	
	/**
	 * job_log.id
	 */
	private Long jobLogId;
	
	/**
	 * 任务动作
	 */
	private JobActionEnum jobAction;
	
	/**
	 * 报错信息
	 */
	private String errorMsg;
	
	/**
	 * 系统异常时候的堆栈
	 */
	private String errStack;
	
	/**
	 * 最终执行状态，初始化为成功<br>
	 */
	private JobStatusEnum finalJobStatus = JobStatusEnum.SUCCESS;
	
	public JobContext(JobDomain jobDomain, String operator, JobActionEnum jobAction) {
		this.jobDomain = jobDomain;
		this.setOperator(operator);
		this.jobAction = jobAction;
		this.setExecStartTime(new Date());
	}

	public JobDomain getJobDomain() {
		return jobDomain;
	}

	public void setJobDomain(JobDomain jobDomain) {
		this.jobDomain = jobDomain;
	}

	public JobXmlConfig getJobXmlConfig() {
		return jobXmlConfig;
	}

	public void setJobXmlConfig(JobXmlConfig jobXmlConfig) {
		this.jobXmlConfig = jobXmlConfig;
	}

	public JobStatusEnum getFinalJobStatus() {
		return this.finalJobStatus;
	}

	public void setFinalJobStatus(JobStatusEnum finalJobStatus) {
		this.finalJobStatus = finalJobStatus;
	}

	public Long getJobLogId() {
		return jobLogId;
	}

	public void setJobLogId(Long jobLogId) {
		this.jobLogId = jobLogId;
	}

	public JobActionEnum getJobAction() {
		return jobAction;
	}

	public void setJobAction(JobActionEnum jobAction) {
		this.jobAction = jobAction;
	}

	public String getErrorMsg() {
		return errorMsg;
	}

	public void setErrorMsg(String errorMsg) {
		this.errorMsg = errorMsg;
	}

	public String getErrStack() {
		return errStack;
	}

	public void setErrStack(String errStack) {
		this.errStack = errStack;
	}
	
}
